#include <iostream>

using namespace std;

typedef long long LL;

const LL p = 100003;

LL n, m;

LL qpow(LL a, LL b, LL p)
{
	LL ret = 1;
	while(b)
	{
		if(b & 1) ret = ret * a % p;
		a = a * a % p;
		b >>= 1;
	}
	return ret;
}

int main()
{
	cin >> m >> n;
	LL ans = qpow(m, n, p);
	LL ret = qpow(m - 1, n - 1, p);
	ret = ret * m % p;
	cout << ((ans - ret) % p + p) % p << endl; 
	return 0;
}
